package com.cs.springcloud.service;

import com.cs.springcloud.entities.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * DeptClientServiceFallbackFactory
 *
 * @author zzc
 * @version 1.00
 * @Date 2019/3/26-14:53
 */
@Component
public class DeptClientServiceFallbackFactory implements FallbackFactory<DeptClientService> {


    @Override
    public DeptClientService create(Throwable throwable) {
        return new DeptClientService() {
            @Override
            public Dept get(Long id) {
                return new Dept().setDname("因为降级，所以没返回了。sorry ~~~///(^v^)\\\\~~~4");
            }

            @Override
            public boolean add(Dept dept) {
                return false;
            }

            @Override
            public List<Dept> list() {
                return null;
            }
        };
    }
}
